package com.smartstate.admin.biz.entity.bo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.smartstate.admin.biz.entity.dto.RolePermissionDto;
import com.smartstate.common.base.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import java.io.Serializable;

@Data
@Entity
@NoArgsConstructor
@TableName("role_permission")
@ApiModel(value = "RolePermission",description = "角色权限设置")
public class RolePermission extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     * */
    @TableId(type = IdType.ASSIGN_ID)
    private String id;

    /**
     * 角色id
     */
    private String roleId;

    @ApiModelProperty("权限类型--1读权限，2写权限,3默认读写")
    Integer roleType;

    /**
     * 权限id
     */
    private String permId;

    public RolePermission(String roleId, String permId,Integer roleType) {
        this.roleId = roleId;
        this.permId = permId;
        this.roleType=roleType;
    }

    public RolePermission(RolePermissionDto rolePermissionDto, String roleId) {
        this.permId = rolePermissionDto.getPermissionId();
        this.roleType = rolePermissionDto.getRoleType();
        this.roleId = roleId;
    }
}
